package com.ds.springboot.mapper;

import com.ds.springboot.pojo.Employee;
import org.apache.ibatis.annotations.*;

/**
 * @program: springboot-1-cache
 * @description:
 * @author: Dawson.Zhang
 * @create: 2020-05-17
 **/
public interface EmpMapper {
    @Select("select * from employee where id = #{id}")
    public Employee getById(Integer id);

    @Update("update employee set lastName = #{lastName},email = #{email},gender = #{gender},d_id=#{dId} where id = #{id}")
    public int updateEmp(Employee employee);

    @Delete("delete  from employee where id = #{id} ")
    public int delEmp(Integer id);

    @Options(useGeneratedKeys = true,keyProperty = "id")
    @Insert("insert into employee(lastName,email,gender,d_id)values(#{lastName},#{email},#{gender},#{dId})")
    public int addEmp(Employee employee);

    @Select("select * from employee where lastName = #{lastName}")
    public Employee getByLastName(String lastName);
}
